{% extends "base.html" %}
{% block title %}公文列表 - YOUER的电子公文系统{% endblock %}
{% block content %}
<div class="card">
  <div class="card-header">
    <h3>公文审核列表</h3>
  </div>
  <div class="card-body">
    {% if documents %}
    <table class="table table-striped">
      <thead>
        <tr>
          <th scope="col">ID</th>
          <th scope="col">标题</th>
          <th scope="col">作者名称</th>
          <th scope="col">发文单位</th>
          <th scope="col">收文单位</th>
          <th scope="col">最后修改日期</th>
          <th scope="col">状态</th>
          <th scope="col">密级</th>
          <th scope="col">操作</th> <!-- 添加操作列标题 -->
        </tr>
      </thead>
      <tbody>
        {% for doc in documents %}
        <tr>
          <td>{{ doc.id }}</td>
          <td>{{ doc.title }}</td>
          <td>{{ doc.author_name }}</td>
          <td>{{ doc.drafting_unit }}</td> <!-- 显示发文单位 -->
          <td>{{ doc.receiving_unit }}</td> <!-- 显示收文单位 -->
          <td>{{ doc.modified_date.strftime('%Y-%m-%d %H:%M:%S') }}</td>
          <td>{{ doc.status }}</td>
          <td>{{ doc.security_level }}</td>
          <td>
            <a href="{{ url_for('document_audit', id=doc.id) }}" class="btn btn-primary btn-sm">审核</a> <!-- 添加编辑按钮，链接到编辑页面并传递文档ID -->
          </td>
        </tr>
        {% endfor %}
      </tbody>
    </table>
    {% else %}
    <p class="text-center">当前无待审核公文。</p>
    {% endif %}
  </div>
</div>
{% endblock %}